package com.celesea.auth.menu.v1.controller;

import com.celesea.auth.menu.entity.Menu;
import com.celesea.auth.menu.service.MenuService;
import com.celesea.framework.api.HttpKit;
import com.celesea.framework.api.Tip;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ${DESCRIPTION}
 *
 * @author JackYuan
 * @create 2017-10-25 21:49
 */
@RestController
@RequestMapping("v1/menus")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @GetMapping
    public Tip<?> index() {
        return HttpKit.success(menuService.selectMenus());
    }

    @GetMapping(value = "/{id}")
    public Tip<Menu> get(@PathVariable String id) {
        return HttpKit.success(menuService.selectById(id));
    }

}
